<template>
   <div class="page-box">
      <div class="page-title">
         {{ "采购明细" }}
      </div>

      <div class="page-search">
         <div
            class="search-box"
            style="height: 40px"
         >
            <el-input
               v-model="search"
               placeholder="采购单号/供应商"
               style="width: 270px; margin-right: 10px"
               suffix-icon="search"
            />
            <el-select
               v-model="search"
               placeholder="产品名称"
               style="width: 270px; margin-right: 10px"
            >
               <el-option
                  v-for="item in 5"
                  :key="item"
                  :label="item"
                  :value="item"
               />
            </el-select>
            <div>
               <el-date-picker
                  v-model="dateRange"
                  style="width: 250px"
                  type="daterange"
                  start-placeholder="开始日期"
                  end-placeholder="结束日期"
                  :default-value="[new Date(2010, 9, 1), new Date(2010, 10, 1)]"
               />
            </div>
            <div style="margin-left: 20px">
               <el-button @click=""> 检索 </el-button>
               <el-button @click=""> 重置 </el-button>
            </div>
         </div>

         <div class="search-btn">
            <div
               class="btn_item"
               @click=""
            >
               <img
                  class="btn_img"
                  src="@/assets/dc.png"
                  alt=""
               />
               <span> 导出 </span>
            </div>
         </div>
      </div>
   </div>

   <div class="table-box">
      <el-table
         :data="tabeData"
         style="width: 100%"
         v-loading="loading"
         border
      >
         <el-table-column
            align="center"
            prop="rowNumber"
            label="采购单号"
            width="100"
         />
         <el-table-column
            align="center"
            prop="house_type_name"
            label="采购日期"
            width="240"
         >
         </el-table-column>
         <el-table-column
            align="center"
            prop="title"
            label="供应商"
            width="240"
         />
         <el-table-column
            align="center"
            prop="category_name"
            label="产品名称"
            width="240"
         >
         </el-table-column>

         <el-table-column
            align="center"
            prop="carport_district_count"
            label="产品编号"
            width="140"
         />

         <el-table-column
            align="center"
            prop="zip"
            label="规格型号"
            width="140"
         />
         <el-table-column
            align="center"
            prop="zip"
            label="单位"
            width="140"
         />
         <el-table-column
            align="center"
            prop="carport_parking_count"
            label="采购数量"
            width="140"
         />
         <el-table-column
            align="center"
            prop="zip"
            label="采购单价(元)"
            width="140"
         />
         <el-table-column
            align="center"
            prop="zip"
            label="折扣"
            width="140"
         />
         <el-table-column
            align="center"
            prop="zip"
            label="整单折扣"
            width="140"
         />
         <el-table-column
            align="center"
            prop="zip"
            label="采购金额(元)"
            width="140"
         />
         <el-table-column
            align="center"
            prop="zip"
            label="入库仓库"
            width="140"
         />
         <el-table-column
            align="center"
            prop="zip"
            label="备注"
            width="140"
         />
      </el-table>
   </div>
   <div class="amount-statistics">
      <div class="amount-statistics-item">
         <p>采购数量合计:</p>
         <p class="deepPurple">1000</p>
      </div>
      <div style="width: 30px"></div>
      <div class="amount-statistics-item">
         <p>采购金额合计:</p>
         <p class="deepPurple">1000</p>
         <div style="width: 10px"></div>
         <p>(大写:壹仟元整)</p>
      </div>
   </div>
   <!-- 分页 -->
   <Pagination
      class="pagination"
      @pageSize="pageSize"
      @getPage="getPage"
      :page="pageData.page"
      :page-size="pageData.pageSize"
      :total="total"
   />
</template>

<script setup lang="ts">
   import { ref, onMounted, watch } from "vue";
   import api from "@/api";

   let IsHeight = ref<number | string>(0);

   const search = ref<string>("");
   const dialogRef = ref<any>(null);
   const dateRange = ref<string[]>([]);
   const pageData = ref({
      pageSize: 10,
      page: 1,
      house_type: "",
      category: "",
      keywords: "",
   });
   const total = ref(0);
   const tabeData = ref([]);
   // 侦听动态分页
   watch(
      () => {
         return pageData.value;
      },
      () => {
         getAlltabeData();
      },
      { deep: true }
   );
   const pageSize = (e: number) => {
      pageData.value.pageSize = e;
   };
   const getPage = (e: number) => {
      pageData.value.page = e;
   };
   onMounted(() => {
      getAlltabeData();
   });

   // 获取门店列表
   const getAlltabeData = async () => {
      const res = await api.parking.getAll({
         ...pageData.value,
      });
      if (res.code == 0) {
         tabeData.value = res.data.data;

         total.value = res.data.total;
      }
   };

   const loading = ref(false);
</script>

<style lang="scss" scoped>
   .btn-box {
      display: flex;
      align-items: center;
      justify-content: center;
   }

   // 输入框样式
   ::v-deep .el-input__wrapper {
      background-color: rgba(250, 252, 251, 1);
   }

   //表格样式

   ::v-deep .el-table {
      --el-table-header-bg-color: rgba(235, 236, 240, 1);
   }

   ::v-deep .el-table thead {
      color: #444;
   }

   //分页样式
   .pagination {
      width: calc(100% - 250px);
      position: fixed;
      bottom: 20px;
      right: 20px;
      padding-top: 10px;
      border-top: 1px solid #98989848;
   }

   ::v-deep .el-pagination.is-background .el-pager li.is-active {
      background-color: #000 !important;
   }
   :deep(.el-checkbox__input.is-checked .el-checkbox__inner) {
      background-color: #6860ff;
      border-color: #6860ff;
   }
   :deep(.el-checkbox__inner:hover) {
      border-color: #626aef !important;
   }
   :deep(.el-checkbox__input.is-indeterminate .el-checkbox__inner) {
      background-color: #6860ff;
   }
   :deep(.el-checkbox__input.is-indeterminate .el-checkbox__inner) {
      border-color: #6860ff;
   }
   :deep(.el-button:hover) {
      background-color: #e2e4fd;
      color: #6860ff;
   }
   :deep(.el-input__wrapper:hover) {
      box-shadow: inset 0 0 0 1px #6860ff;
   }
   :deep(.el-button:hover) {
      background-color: #e2e4fd;
      color: #6860ff;
   }
   .deepPurple {
      color: #7a60fe;
      margin-left: 10px;
   }
   .amount-statistics {
      display: flex;
      justify-content: start;
      align-items: center;
      padding: 10px 20px;
      background-color: #f2f2f2;
      margin-top: 20px;
      border-radius: 5px;
      .amount-statistics-item {
         display: flex;
         align-items: center;
         justify-content: center;
         margin-right: 20px;
      }
   }
</style>
